home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cmln1185.arc / CROSSTH2.LTG < prev    next >
Text File  |  1986-02-27  |  1KB  |  34 lines

  1.  
  2.  
  3.                            Listinτ 2«  
  4. PP╠ codσ fo≥ trisectioε roo⌠ seekinτ methoΣ usinτ ß tota∞ oµ tw∩ ì
  5. CPUs.
  6.  
  7.  
  8. FUNCTIO╬ Trisection(Guess_A¼ Guess_B¼ Accurac∙ ║ real
  9.                      FofX(° ║ real⌐ ║ real⌐ returε real
  10.  
  11. -¡ FofX(x⌐ i≤ thσ functioε whosσ roo⌠ i≤ sought
  12.  
  13. VA╥ S▒ ║ Process_Signals
  14.  
  15. BEGIN
  16.     INITIALIZE║ Fß ╜ FofX(Guess_A)╗ FΓ ╜ FofX(Guess_B)
  17.     LOO╨ <Find_Root>
  18.     BEGIN
  19.         New_Guess▒ ╜ Guess_┴ ½ (Guess_┬ ¡ Guess_A⌐ » 3
  20.         New_Guess▓ ╜ Guess_┬ ¡ (Guess_┬ ¡ Guess_A⌐ » 3
  21.         StartFunction(FofX(New_Guess1),Pr,F1,S1)
  22.         F▓ ╜ FofX(New_Guess2)
  23.         Wait(S1⌐ -¡ wai⌠ fo≥ F▒ result
  24.         In_Left_Flaτ ╜ Fß ¬ F▒ ╝ 0╗ In_Right_Flaτ ╜ F▓ ¬ FΓ ╝ 0
  25.         I╞ In_Left_Flaτ THE╬ Guess_┬ ╜ New_Guess1╗ FΓ ╜ F1
  26.         ELSEI╞ In_Right_Flaτ THE╬ Guess_┴ ╜ M2╗ Fß ╜ F2
  27.         ELS┼ Guess_┴ ╜ New_Guess1╗ Fß ╜ F1╗ Guess_┬ ╜ New_Guess2╗ FΓ ╜ F▓ 
  28.         EN─ IF
  29.  
  30.         I╞ ABS(Guess_┴ ¡ Guess_B⌐ <╜ Accurac∙  THE╬ EXI╘ EN─ IF
  31.     EN─ LOO╨ <Find_Root>
  32.     TERMINATE║ returε ¿ (Guess_┴ ½ Guess_B)/▓ )
  33. EN─ Trisection
  34.